<?php
	//跨域被请求必须加,冒号后面代表请求的网站网址,*代表任何网站都可以跨域请求该php页面的数据
	header("Access-Control-Allow-Origin:*");
	include('include/config.php');
	include('include/rsa.php');
	include('include/pinyin.php');
	include('include/isRegister.php');
	include('include/returnParameters.php');
	$user = $_POST['user'];
	$password = $_POST['password'];
	$enterpriseName = $_POST['enterpriseName'];
	
	$registerInfo = registers($user, $password, $enterpriseName);
	//echo json_encode($registerInfo);exit();
	$name = $registerInfo['user'];
	$names = pinyin::utf8_to($registerInfo['enterpriseName']);
    
	$u = mysqlName($name);
	$q = mysqluser($names);
	$arr = array(
		"a" => $u,
		"b" => $q
	);
	
	if(empty($arr['a']) && empty($arr['b'])){
		$time = addOne();
		if ($time == 0){
			$isMessage = '注册成功';
			$code = 0;
			$data = commonparameters($isMessage, $code);
			echo json_encode($data);exit();
		} else {
			$isMessage = '服务器错误...';
			$code = 1;
			$data = commonparameters($isMessage, $code);
			echo json_encode($data);exit();
		}
	} else {
		$isMessage = '用户或者企业已存在';
		$code = 1;
		$data = commonparameters($isMessage, $code);
		echo json_encode($data);exit();
	}
	
	
	









?>